import Vue from 'vue'
import VueRouter from 'vue-router'

VueRouter.prototype.back = false;
VueRouter.prototype.goBack = function () {
  this.back = true;
  this.go(-1);
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    component: () => import("@/views/Home"),
    children: [
      {
        path: '/home/classify',
        name: 'classify',
        component: () => import("@/views/Classify"),
      },
      {
        path: '/home/shopping',
        component: () => import("@/views/Shopping"),
      },
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/Search'),
  },
  {
    path: '*',
    redirect: '/home/classify'
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

export default router;
